work around bug with gbfseek that results in premature eof indications on uncompresse...
authortsteven4 <tsteven4@gmail.com>
Mon, 28 Apr 2014 22:23:05 +0000 (22:23 +0000)
committertsteven4 <tsteven4@gmail.com>
Mon, 28 Apr 2014 22:23:05 +0000 (22:23 +0000)
gpsbabel/gbfile.cc
gpsbabel/zlib/README.gpsbabel
gpsbabel/zlib/gzlib.c
gpsbabel/zlib/gzlib.patch [new file with mode: 0644]

index 1b5d3f5422ac161b48c98367a2182b82430abca7..a5ae1f1202e7387d87166926633bf3f5e3bd50dd 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #include "defs.h"
-#include "zlib/zconf.h"
 #include "gbfile.h"
 
 #include <assert.h>
@@ -29,7 +28,6 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <QtCore/QDebug>
 
 
 #if __WIN32__
index b6d1e957ca645ded6f8a701c129bbec05e3d2632..350f999a6d8607fe1cddc0c284f96b404cb4daa3 100644 (file)
@@ -1 +1,5 @@
-Unmodified wubset of zlib-1.2.8 from zlib.net.
+modified subset of zlib-1.2.8 from zlib.net.
+1.  zconf.h is modified to include our config.h
+2.  gzlib.c is modified to resolve a seek problem with uncompressed files on windows platforms build with mingw32 gcc.
+see gzlib.patch
+
index fae202ef8905a3c99e4b71d756a45d55f9b1c163..64ca8db379daef8bedeec4c97821cb36b917d044 100644 (file)
@@ -393,7 +393,10 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
     /* if within raw area while reading, just go there */
     if (state->mode == GZ_READ && state->how == COPY &&
             state->x.pos + offset >= 0) {
-        ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
+/* Start GPSBabel local */
+/*      ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); */
+        ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
+/* end GPSBabel local */
         if (ret == -1)
             return -1;
         state->x.have = 0;
diff --git a/gpsbabel/zlib/gzlib.patch b/gpsbabel/zlib/gzlib.patch
new file mode 100644 (file)
index 0000000..7651203
--- /dev/null
@@ -0,0 +1,14 @@
+--- gzlib.c    2014-04-28 16:19:19.839086477 -0600
++++ gzlib.patch.c      2014-04-28 16:18:31.220835104 -0600
+@@ -393,7 +393,10 @@
+     /* if within raw area while reading, just go there */
+     if (state->mode == GZ_READ && state->how == COPY &&
+             state->x.pos + offset >= 0) {
+-        ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
++/* Start GPSBabel local */
++/*      ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); */
++        ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
++/* end GPSBabel local */
+         if (ret == -1)
+             return -1;
+         state->x.have = 0;